<template>
	<div>
		<div>
			<van-nav-bar title="我的" />
		</div>
		<div style="padding: 10px;">
			<van-button color="#0d8ddd" size="large" round @click="userLogin()">退出登录</van-button>
		</div>
		<div>
			<van-tabbar v-model="active" route>
				<van-tabbar-item to='/community'>
					<span>社区</span>
					<template slot="icon">
						<img src="@/assets/tabbar/community.png">
					</template>
				</van-tabbar-item>
				<van-tabbar-item to='/analysis'>
					<span>数据分析</span>
					<template slot="icon">
						<img src="@/assets/tabbar/analysis.png">
					</template>
				</van-tabbar-item>
				<van-tabbar-item to='/home'>
					<template slot="icon">
						<img src="@/assets/tabbar/home.png">
					</template>
				</van-tabbar-item>
				<van-tabbar-item to='/service'>
					<span>服务</span>
					<template slot="icon">
						<img src="@/assets/tabbar/service.png">
					</template>
				</van-tabbar-item>
				<van-tabbar-item to='/mine'>
					<span>我的</span>
					<template slot="icon">
						<img src="@/assets/tabbar/mine.png">
					</template>
				</van-tabbar-item>
			</van-tabbar>
		</div>
	</div>
</template>

<script>
	import request from '@/util/request'
	import {
		getBaseUrl
	} from '@/util/env'
	export default {
		name: 'mine',
		data() {
			return {
				active: '/mine'
			}
		},
		methods: {
			userLogin() {
				return request({
					url: '/dev-api/logout',
					method: 'post'
				}).then(res => {
					if (res.code === 200) {
						window.localStorage.removeItem('token')
						window.localStorage.removeItem('userInfo')
						window.localStorage.setItem('hasLogin', false)
						this.$router.push('/')
					}
				})
			}
		}
	}
</script>

<style>
</style>
